num = str(2**1000)
s = 0
for x in num:
	s = s + int(x)
	
print(s)